package com.aspose.cells;

import java.math.BigDecimal;
import java.util.Calendar;
import java.util.Date;

class zfv {
   short a;
   int b;
   int c;
   Object d;
   boolean e;

   zfv() {
      this.b = -1;
      this.c = 0;
      this.e = false;
   }

   zfv(int var1) {
      this.b = -1;
      this.c = 0;
      this.e = false;
      this.a = (short)var1;
   }

   zfv(zfv var1) {
      this.a = var1.a;
      this.b = var1.b;
      this.c = var1.c;
      this.d = var1.d;
      this.e = var1.e;
   }

   void a(zfv var1) {
      this.a = var1.a;
      this.b = var1.b;
      this.c = var1.c;
      this.d = var1.d;
      this.e = var1.e;
   }

   void a(zfv var1, int var2) {
      if (var2 == 7) {
         this.a(var1);
      } else {
         if ((var2 & 1) != 0) {
            this.a = var1.a;
         }

         if ((var2 & 2) != 0) {
            this.b = var1.b;
         }

         if ((var2 & 4) != 0) {
            this.c = var1.c;
            this.d = var1.d;
            this.e = var1.e;
         }

      }
   }

   void a(int var1) {
      this.a = (short)var1;
      this.b = -1;
      this.c = 0;
      this.d = null;
      this.e = false;
   }

   boolean a() {
      if (this.d == null) {
         return true;
      } else {
         return this.c == 4 ? "".equals(((zayy)this.d).c) : false;
      }
   }

   boolean b() {
      switch(this.c) {
      case 0:
         return true;
      case 4:
         return "".equals(((zayy)this.d).c);
      case 5:
         zyi var1 = (zyi)this.d;
         switch(var1.c) {
         case 0:
            return true;
         case 4:
            return "".equals((String)var1.d);
         default:
            return false;
         }
      default:
         return false;
      }
   }

   boolean c() {
      if (this.c == 4) {
         zayy var1 = (zayy)this.d;
         return var1.f();
      } else {
         return false;
      }
   }

   zfv d() {
      zfv var1;
      switch(this.c) {
      case 4:
         var1 = new zfv(this);
         var1.d = ((zayy)this.d).c;
         return var1;
      case 5:
         zyi var3 = (zyi)this.d;
         zfv var2 = new zfv(this);
         if (var3.c == 6) {
            this.b(var2, (Integer)var3.d);
            return var2;
         }

         var2.c = var3.c;
         var2.d = var3.d;
         return var2;
      case 6:
         var1 = new zfv(this);
         this.b(var1, (Integer)this.d);
         return var1;
      default:
         return this;
      }
   }

   boolean e() {
      switch(this.c) {
      case 1:
      case 6:
         return true;
      case 5:
         int var1 = ((zyi)this.d).c;
         return var1 == 1 || var1 == 6;
      default:
         return false;
      }
   }

   private void b(zfv var1, int var2) {
      if ((var2 & 3) == 2) {
         var1.c = 6;
         var1.d = var2 >> 2;
      } else {
         var1.c = 1;
         var1.d = zavz.a(var2);
      }

   }

   String a(boolean var1) {
      return a(this.c, this.d, var1);
   }

   static String a(int var0, Object var1, boolean var2) {
      switch(var0) {
      case 0:
         return "";
      case 1:
         return com.aspose.cells.a.c.zp.c((Double)var1);
      case 2:
      default:
         return com.aspose.cells.b.a.zr.a(var1);
      case 3:
         return a(var1);
      case 4:
         if (var2) {
            return ((zayy)var1).c;
         }

         return (String)var1;
      case 5:
         zyi var3 = (zyi)var1;
         return a(var3.c, var3.d, false);
      case 6:
         return zavz.b((Integer)var1);
      }
   }

   String f() {
      return a(this.c == 5 ? ((zyi)this.d).d : this.d);
   }

   static String a(Object var0) {
      String var1 = zsk.b((Byte)var0);
      return var1 == null ? "#VALUE!" : var1;
   }

   int g() {
      if (this.d == null) {
         return 3;
      } else {
         int var1 = this.c;
         if (var1 == 5) {
            var1 = ((zyi)this.d).c;
         }

         switch(var1) {
         case 0:
            return 3;
         case 1:
            return 4;
         case 2:
            return 0;
         case 3:
            return 2;
         case 4:
            return 5;
         default:
            return 6;
         }
      }
   }

   boolean b(zfv var1) {
      if (this.c == 0) {
         return var1.c == 0 || var1.c == 5 && ((zyi)var1.d).c == 0;
      } else if (var1.c == 0) {
         return this.c == 5 && ((zyi)this.d).c == 0;
      } else {
         int var2;
         Object var4;
         zyi var6;
         if (this.c == 5) {
            var6 = (zyi)this.d;
            var2 = var6.c;
            var4 = var6.d;
         } else if (this.c == 4) {
            var2 = 4;
            var4 = ((zayy)this.d).c;
         } else {
            var2 = this.c;
            var4 = this.d;
         }

         int var3;
         Object var5;
         if (var1.c == 5) {
            var6 = (zyi)var1.d;
            var3 = var6.c;
            var5 = var6.d;
         } else if (var1.c == 4) {
            var3 = 4;
            var5 = ((zayy)var1.d).c;
         } else {
            var3 = var1.c;
            var5 = var1.d;
         }

         if (var2 == 6) {
            if (var3 == 6) {
               return var4.equals(var5);
            } else if (var3 == 1) {
               return zavz.a((Integer)var4) == (Double)var5;
            } else {
               return false;
            }
         } else if (var2 == 1) {
            if (var3 == 6) {
               return zavz.a((Integer)var5) == (Double)var4;
            } else {
               return var3 == 1 ? var4.equals(var5) : false;
            }
         } else {
            return var2 == var3 && var4.equals(var5);
         }
      }
   }

   boolean a(Object var1, boolean var2) {
      if (var1 == null) {
         this.c = 0;
         this.d = null;
         return true;
      } else {
         return this.b(zamo.a(var1.getClass()), var1, var2);
      }
   }

   boolean b(int var1, Object var2, boolean var3) {
      double var7;
      switch(var1) {
      case 0:
      case 2:
         this.c = 0;
         this.d = null;
         return true;
      case 1:
      case 15:
      case 17:
      default:
         if (var2 instanceof Calendar) {
            this.c = 1;
            this.d = new DateTime((Calendar)var2);
            return false;
         } else if (var2 instanceof Date) {
            this.c = 1;
            this.d = new DateTime((Date)var2);
            return false;
         } else if (var2 instanceof Number) {
            var7 = ((Number)var2).doubleValue();
            if (var3) {
               zavz.a(var7, this);
            } else {
               this.c = 1;
               this.d = var7;
            }

            return true;
         } else {
            if (var2 instanceof BigDecimal) {
               if (var3) {
                  zavz.a(com.aspose.cells.b.a.zr.a(var2), this);
               } else {
                  this.c = 1;
                  this.d = ((BigDecimal)var2).doubleValue();
               }

               return true;
            }

            return this.b(18, com.aspose.cells.b.a.zr.a(var2), var3);
         }
      case 3:
         this.c = 2;
         this.d = com.aspose.cells.a.c.zi.d(var2) ? zml.d : zml.e;
         return true;
      case 4:
         this.c = 4;
         this.d = Character.toString((Character)var2);
         return false;
      case 5:
         if (var3) {
            zavz.a((long)(Byte)var2, this);
         } else {
            this.c = 1;
            this.d = (double)(Byte)var2;
         }

         return true;
      case 6:
         if (var3) {
            zavz.a((long)(Byte)var2, this);
         } else {
            this.c = 1;
            this.d = (double)(Byte)var2;
         }

         return true;
      case 7:
         if (var3) {
            zavz.a((long)(Short)var2, this);
         } else {
            this.c = 1;
            this.d = (double)(Short)var2;
         }

         return true;
      case 8:
         if (var3) {
            zavz.a((long)(Integer)var2, this);
         } else {
            this.c = 1;
            this.d = (double)(Integer)var2;
         }

         return true;
      case 9:
         if (var3) {
            zavz.a((long)com.aspose.cells.a.c.zi.c(var2), this);
         } else {
            this.c = 1;
            this.d = (double)com.aspose.cells.a.c.zi.c(var2);
         }

         return true;
      case 10:
         if (var3) {
            zavz.a((Long)var2 & 4294967295L, this);
         } else {
            this.c = 1;
            this.d = (double)(Long)var2;
         }

         return true;
      case 11:
         if (var3) {
            zavz.a((Long)var2, this);
         } else {
            this.c = 1;
            this.d = (double)(Long)var2;
         }

         return true;
      case 12:
         if (var3) {
            zavz.a((Long)var2, this);
         } else {
            this.c = 1;
            this.d = (double)(Long)var2;
         }

         return true;
      case 13:
         if (var3) {
            zavz.a((double)(Float)var2, this);
         } else {
            this.c = 1;
            this.d = (double)(Float)var2;
         }

         return true;
      case 14:
         var7 = com.aspose.cells.a.c.zi.b(var2);
         if (!Double.isNaN(var7) && !Double.isInfinite(var7)) {
            if (var3) {
               zavz.a((Double)var2, this);
            } else {
               this.c = 1;
               this.d = var7;
            }
         } else {
            zst var6 = zst.c;
            this.c = 3;
            this.d = com.aspose.cells.a.c.zi.a(zsk.b(var6));
         }

         return true;
      case 16:
         this.c = 1;
         this.d = (DateTime)var2;
         return false;
      case 18:
         byte var4 = zsk.a((String)var2);
         if (var4 != -1) {
            this.c = 3;
            this.d = com.aspose.cells.a.c.zi.a(var4);
            return true;
         } else {
            this.c = 4;
            this.d = var2;
            return false;
         }
      }
   }

   boolean a(DateTime var1, boolean var2) {
      double var3 = zbtq.a(var1, var2);
      if (var3 < 0.0D) {
         return false;
      } else {
         zavz.a(var3, this);
         return true;
      }
   }
}
